package pers.jsan.litheopen.security.oauth.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import pers.jsan.litheopen.security.oauth.model.ClientAccess;
import pers.jsan.litheopen.security.oauth.service.IClientOauthService;
import pers.jsan.litheopen.utils.Result;

@RestController
public class ClientOauthController {

    @Autowired
    private IClientOauthService clientOauthService;

    /**
     * 申请客户端凭证
     * @param clientAccess 客户端信息
     * @return Result
     */
    @PostMapping("oauth/accessToken")
    public Result accessToken(@RequestBody ClientAccess clientAccess) {
        return Result.ok(clientOauthService.getAccessToken(clientAccess));
    }
}
